
//OLD MAIN, BEFORE GAME CLASS AND REFACTORING
/*
#include "SnakeVector.h"
#include "SnakeSegment.h"
#include "Defines.h"
#include <iostream>
using namespace std;


//print the details for each individual segment
void print(SnakeSegment &piece)
{
	cout << "X: " << piece.m_x << " -- Y: " << piece.m_y;
	switch(piece.m_direction)
	{
	case 0:
		cout << " -- UP";
		break;
	case 1:
		cout << " -- DOWN";
		break;
	case 2:
		cout << " -- RIGHT";
		break;
	case 3:
		cout << " -- LEFT";
		break;
	}
	cout << endl;
}

//cycle through and print the details for each segment
void printAll(SnakeVector<SnakeSegment> &snake)
{
	for(int i = 0; i < snake.size(); ++i)
	{
		print(*snake.getRawData(i));
	}
}

//add a new segment to the snake
void add(SnakeVector<SnakeSegment> &snake)
{
	SnakeSegment newPiece;

	switch(snake.getTail()->m_direction)
	{
	case 0://DIRECTION_UP:
		newPiece.m_x = snake.getTail()->m_x;
		newPiece.m_y = snake.getTail()->m_y +1;
		break;
	case 1://DIRECTION_DOWN:
		newPiece.m_x = snake.getTail()->m_x;
		newPiece.m_y = snake.getTail()->m_y -1;
		break;
	case 2://DIRECTION_RIGHT:
		newPiece.m_x = snake.getTail()->m_x -1;
		newPiece.m_y = snake.getTail()->m_y;
		break;
	case 3://DIRECTION_LEFT:
		newPiece.m_x = snake.getTail()->m_x +1;
		newPiece.m_y = snake.getTail()->m_y;
		break;
	}
	newPiece.m_direction = snake.getTail()->m_direction;
	snake.add(newPiece);
}


//move each segment individually and update its direction
int move(SnakeVector<SnakeSegment> &snake, int segmentNo, int dirOfPrevSegment)
{
	//save old direction
	int oldDirection = snake.getRawData(segmentNo)->m_direction;
	//move segment in its current direction
	switch(snake.getRawData(segmentNo)->m_direction)
	{
	case 0://DIRECTION_UP:
		snake.getRawData(segmentNo)->m_y--;
		break;
	case 1://DIRECTION_DOWN:
		snake.getRawData(segmentNo)->m_y++;
		break;
	case 2://DIRECTION_RIGHT:
		snake.getRawData(segmentNo)->m_x++;
		break;
	case 3://DIRECTION_LEFT:
		snake.getRawData(segmentNo)->m_x--;
		break;
	}
	//set direction equal to previous piece
	snake.getRawData(segmentNo)->m_direction = dirOfPrevSegment;
	//return old direction
	return oldDirection;
}

//cycle through and move each segment
void moveAll(SnakeVector<SnakeSegment> &snake)
{
	//create variable to store the direction for the next segment
	int dirOfNextPiece = snake.getHead()->m_direction;
	//move each segment
	for(int i = 0; i < snake.size(); ++i)
	{
		dirOfNextPiece = move(snake, i, dirOfNextPiece);
	}

}

//main
int main()
{
	SnakeVector<SnakeSegment> test;
	int dir = DIRECTION_LEFT;
	SnakeSegment temp(0,0,dir);
	test.add(temp);
	dir = test.getHead()->m_direction;
	cout << dir << endl;
	dir = test.getTail()->m_direction;
	cout << dir << endl;
	dir = test.getRawData(0)->m_direction;
	cout << dir << endl;
	dir = test.getRawList()->m_direction;
	cout << dir << endl;
	int inputBuffer = 1;
	while(inputBuffer != 0)
	{
		cin >> inputBuffer;
		switch(inputBuffer)
		{
		case 0:
			break;
		case 2:
			test.getHead()->m_direction = DIRECTION_LEFT;
			break;
		case 3:
			test.getHead()->m_direction = DIRECTION_DOWN;
			break;
		case 4:
			test.getHead()->m_direction = DIRECTION_RIGHT;
			break;
		case 5:
			test.getHead()->m_direction = DIRECTION_UP;
			break;
		case 6:
			add(test);
			break;
		case 7:
			moveAll(test);
			break;
		}
		if(inputBuffer != 0)
		{inputBuffer = 1;} //clear buffer
		printAll(test);
		//Sleep(500);
	}
	return 0;
}


//*/




//OLD MOVE FUNCTIONS...BULKY AND BROKE
/*
bool move(SnakeVector<SnakeSegment> &snake, int segmentNo, bool goStraight)
{
	int oldDirection = snake.getRawData(segmentNo)->m_direction;

	if(goStraight)
	{
		switch(snake.getRawData(segmentNo)->m_direction)
		{
		case 0://DIRECTION_UP:
			snake.getRawData(segmentNo)->m_y--;
			break;
		case 1://DIRECTION_DOWN:
			snake.getRawData(segmentNo)->m_y++;
			break;
		case 2://DIRECTION_RIGHT:
			snake.getRawData(segmentNo)->m_x++;
			break;
		case 3://DIRECTION_LEFT:
			snake.getRawData(segmentNo)->m_x--;
			break;
		}
	}
	else
	{
		if(snake.getRawData(segmentNo-1)->m_direction == snake.getRawData(segmentNo)->m_direction)
		//if the previous and next segments are moving in the same direction
		{
			switch(snake.getRawData(segmentNo)->m_direction)
			{
			case 0://DIRECTION_UP:
				snake.getRawData(segmentNo)->m_y--;
				break;
			case 1://DIRECTION_DOWN:
				snake.getRawData(segmentNo)->m_y++;
				break;
			case 2://DIRECTION_RIGHT:
				snake.getRawData(segmentNo)->m_x++;
				break;
			case 3://DIRECTION_LEFT:
				snake.getRawData(segmentNo)->m_x--;
				break;
			}
		}
		else
		{
			//snake.getRawData(segmentNo)->m_direction = snake.getRawData(segmentNo-1)->m_direction;
			switch(snake.getRawData(segmentNo)->m_direction)
			{
			case 0://DIRECTION_UP:
				snake.getRawData(segmentNo)->m_y--;
				break;
			case 1://DIRECTION_DOWN:
				snake.getRawData(segmentNo)->m_y++;
				break;
			case 2://DIRECTION_RIGHT:
				snake.getRawData(segmentNo)->m_x++;
				break;
			case 3://DIRECTION_LEFT:
				snake.getRawData(segmentNo)->m_x--;
				break;
			}
			snake.getRawData(segmentNo)->m_direction = snake.getRawData(segmentNo-1)->m_direction;
		}

	}
	if(oldDirection == snake.getRawData(segmentNo)->m_direction)
		return false; //no change in direction
	else
		return true;//change in direction

}
void moveAll(SnakeVector<SnakeSegment> &snake)
{
	bool moveNextPieceStraight = false;
	
	moveNextPieceStraight = move(snake, 0, true);
	for(int i = 1; i < snake.size(); ++i)
	{
		moveNextPieceStraight = move(snake, i, moveNextPieceStraight);
	}
	//move(snake, snake.size()-1, moveNextPieceStraight);
}
*/